unit ClientDataModuleUnit;

interface

uses
  System.SysUtils, System.Classes, Data.DBXDataSnap, IndyPeerImpl,
  Data.DBXCommon, Datasnap.DSHTTPLayer, Data.DB, Datasnap.DBClient,
  Datasnap.DSConnect, Data.SqlExpr, DbxCompressionFilter;

type
  TClientDataModule = class(TDataModule)
    WebBrokerProviderConnection: TDSProviderConnection;
    cdsRequesterQueue: TClientDataSet;
    WebBrokerConnection: TSQLConnection;
    cdsRequesterQueueLastModified: TSQLTimeStampField;
    cdsRequesterQueueName: TStringField;
    cdsRequesterQueuePriority: TIntegerField;
    cdsRequesterQueueRealm: TStringField;
    cdsRequesterQueueRequestHttpCode: TIntegerField;
    cdsRequesterQueueRequestResult: TMemoField;
    cdsRequesterQueueRequestTime: TSQLTimeStampField;
    cdsRequesterQueueRequestTry: TIntegerField;
    cdsRequesterQueueStatus: TIntegerField;
    cdsRequesterQueueType: TIntegerField;
    cdsRequesterQueueUrlValue: TStringField;

  private
    FConnected: Boolean;
    FRequesterId: String;
  public
    property Connected: Boolean read FConnected write FConnected;
    property RequesterId: String read FRequesterId write FRequesterId;
    constructor Create(Owner: TComponent; Requester: String); overload;
  end;

implementation

{ %CLASSGROUP 'System.Classes.TPersistent' }

constructor TClientDataModule.Create(Owner: TComponent; Requester: String);
begin
  inherited Create(Owner); // Initialize inherited parts
  WebBrokerConnection := TSQLConnection.Create(nil);
  WebBrokerProviderConnection := TDSProviderConnection.Create
    (WebBrokerConnection);
  RequesterId := Requester;

  // Initialize Requester Queue
  cdsRequesterQueue.Params.ParamByName('RequesterId').AsString := RequesterId;

  // Activate Requester Queue
  cdsRequesterQueue.Active := true;
  // Activate URL Queue
  //cdsUrlQueue.Active := true;

end;

{$R *.dfm}

end.
